package com.lagou.balance.impl;

import com.lagou.server.RpcClient;

import java.util.List;
import java.util.Random;

public class RandomLoadBalance extends AbstractLoadBalanceStrategy {
    private final Random random = new Random();

    @Override
    protected RpcClient doSelect(List<RpcClient> rpcClients) {
        int size = rpcClients.size();
        int index = random.nextInt(size);
        return rpcClients.get(index);
    }
}
